Skip to content

Comments

Fix ZenMux model metadata and native tool message handling#5831

Merged
kevinvandijk merged 2 commits intoKilo-Org:mainfrom
Neonsy:fix/zenmux-provider-error
Feb 16, 2026
Merged

Fix ZenMux model metadata and native tool message handling#5831
kevinvandijk merged 2 commits intoKilo-Org:mainfrom
Neonsy:fix/zenmux-provider-error

Conversation

@Neonsy
Copy link

@Neonsy Neonsy commented Feb 12, 2026

Context

ZenMux had two related reliability issues:

  1. Model metadata/caching could produce invalid or incomplete model capabilities (notably around context window and native tool support), which led to unstable behavior.
  2. Native tool-call flow in ZenMux could trigger repeated "tool not used" retry loops because tool capability and request-shaping were not consistently preserved through runtime paths.

This PR hardens ZenMux model normalization/caching and fixes the native tool/message pipeline so tool-enabled tasks behave consistently.

Implementation

This PR combines two branch commits:

  • first commit: Context window/cache hardening

    • Maps ZenMux context_length into contextWindow.
    • Adds fallback behavior when optional model metadata is missing.
    • Adds stale ZenMux cache self-healing for invalid contextWindow <= 0 records.
    • Adds/extends ZenMux fetcher and model cache tests for stale cache rejection and valid cache acceptance.
  • second commit: Native tool reliability + pipeline cleanup

    • Adds explicit native-tool defaults for ZenMux model info (supportsNativeTools, defaultToolProtocol).
    • Ensures fetched ZenMux models include native-tool metadata.
    • Merges native-tool defaults at runtime to self-heal stale model entries missing native tool fields.
    • Respects task-locked toolProtocol and gates tool params accordingly.
    • Refactors ZenMux stream creation to use already-transformed OpenAI messages (instead of rebuilding from raw messages), preserving protocol/model-specific transforms.
    • Adds dedicated regression tests covering:
      • stale metadata default merge
      • native vs xml tool gating
      • DeepSeek R1 transformed-message passthrough
    • Adds user-facing patch changeset for release notes.

How to Test

  1. Run ZenMux-targeted backend tests from src:
  • cd src && pnpm test api/providers/fetchers/__tests__/zenmux.spec.ts
  • cd src && pnpm test api/providers/__tests__/zenmux.spec.ts
  • cd src && pnpm test api/providers/__tests__/zenmux-native-tools.spec.ts
  1. Run extension-wide backend suite:
  • cd src && pnpm test
  1. Validate repo gates:
  • pnpm check-types
  • pnpm lint
  • pnpm build
  1. Manual behavior check (ZenMux):
  • Configure provider: zenmux
  • Use model: z-ai/glm-5
  • In Ask mode, send a simple prompt like hi
  • Confirm it does not enter repeated "did not use a tool" retry loops due to missing native-tool wiring.

Note

The final implementation was AI assisted

@simonleung963 reported the problem on Discord and tested my custom builds.

@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 26e4e1a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Neonsy Neonsy force-pushed the fix/zenmux-provider-error branch from 49fddf7 to b7d3c5c Compare February 12, 2026 18:33
@Neonsy
Copy link
Author

Neonsy commented Feb 12, 2026

@kevinvandijk I'm back 😄

@Neonsy
Copy link
Author

Neonsy commented Feb 12, 2026

GLM 5.0, Sonnet 4.5, and Minimax 2.5 have been tested

@Neonsy Neonsy changed the title ZenMux model metadata and native tool message pipeline handling Fix ZenMux model metadata and native tool message handling Feb 12, 2026
@Neonsy Neonsy force-pushed the fix/zenmux-provider-error branch from b7d3c5c to 0056b13 Compare February 13, 2026 15:16
@Neonsy
Copy link
Author

Neonsy commented Feb 13, 2026

Flaky test failure

@Neonsy Neonsy force-pushed the fix/zenmux-provider-error branch 3 times, most recently from f77eee8 to 4d2ef9d Compare February 14, 2026 11:03
jeremylongshore added a commit to jeremylongshore/kilocode that referenced this pull request Feb 15, 2026
jeremylongshore added a commit to jeremylongshore/kilocode that referenced this pull request Feb 15, 2026
Mirror: Fix ZenMux model metadata and native tool message handling (Kilo-Org#5831)
@Neonsy Neonsy force-pushed the fix/zenmux-provider-error branch from 4d2ef9d to b11ae02 Compare February 15, 2026 18:45
jeremylongshore added a commit to jeremylongshore/kilocode that referenced this pull request Feb 15, 2026
@Neonsy Neonsy force-pushed the fix/zenmux-provider-error branch from b11ae02 to f2ec310 Compare February 16, 2026 06:41
@Neonsy Neonsy force-pushed the fix/zenmux-provider-error branch from f2ec310 to 26e4e1a Compare February 16, 2026 12:45
Copy link
Collaborator

@kevinvandijk kevinvandijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants